package ro.isdc.training.ejb3.course.service.domain;

import ro.isdc.training.ejb3.course.domain.CourseId;
import ro.isdc.training.ejb3.misc.service.domain.ServiceRequest;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * Request for the readCourse() service.
 * 
 * @author Andrei Chirila
 */
public class ReadCourseRequest extends ServiceRequest {
  /**
   * Generated Serial Version UID.
   */
  private static final long serialVersionUID = -4666745843942043182L;
  
  /**
   * Course id.
   */
  private CourseId courseId;

  /**
   * @return the courseId
   */
  public CourseId getCourseId() {
    return courseId;
  }

  /**
   * @param courseId the courseId to set
   */
  public void setCourseId(final CourseId courseId) {
    this.courseId = courseId;
  }

  /**
   * @see java.lang.Object#equals(Object)
   */
  public boolean equals(final Object object) {
    if (object == this) {
      return true;
    }
    if (!(object instanceof ReadCourseRequest)) {
      return false;
    }
    ReadCourseRequest rhs = (ReadCourseRequest) object;
    return new EqualsBuilder().append(this.courseId, rhs.courseId).isEquals();
  }

  /**
   * @see java.lang.Object#hashCode()
   */
  public int hashCode() {
    return new HashCodeBuilder(1386237673, 1914981729).append(this.courseId)
        .toHashCode();
  }

  /**
   * @see java.lang.Object#toString()
   */
  public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append(
        "courseId", this.courseId).toString();
  }
  
}
